$(function() {
	if(dataGet("openId") == "") {
		dataSave("loginType", "equipment");
		nextView("../../../page/OAuthGetCodeLogin.html");
	}
	
	validSession();
	if(!dataGet('isLogined')){
		dataSave("openId", "");
		dataSave("loginType", "equipment");
		nextView("../../../page/OAuthGetCodeLogin.html");
		return;
	}
	
	$(".list").delegate(".list-li","click",function(){
		dataSave('pname',$(this).attr("data-name"));
		dataSave('pcolor',$(this).attr("data-color"));
		dataSave('pfault',$(this).attr("data-fault"));
		nextView('fault.html');	
	});

	loaded();
});
function loaded(){
	var url = urlfile + "coreRepairType/find/all";
    var data = "";
    ajaxTool("post",data,url,
        function error(XMLHttpRequest, textStatus, errorThrown,fnErr){
            alert("error:" + XMLHttpRequest);
        },
        function success(data){
            if(!data.success) {
                alert(data.errMsg);
            }else{
            	var strhtml_list = "";
				var arrData = data.data;
				var ln = arrData.length;
				
				for(var i=0;i<ln;i++){
                    strhtml_list +='<li class="list-li" data-color="'+arrData[i].crrteColor+'" data-fault="'+arrData[i].crrteFault+'" data-name="'+arrData[i].crrteName+'">'+arrData[i].crrteName+'</li>';
					$('.list').html(strhtml_list);
            	}
            }
    });
}